<template>
	<view>
		我的页面
		<navigator open-type="navigate" url="/pages/user/register/register">跳转到注册页面</navigator>
		<navigator open-type="navigate" url="login/login">跳转到登录页面</navigator>
		<button @tap="goCart">购物车</button>
		<button @tap="goOrderStatus">订单状态页面</button>
		<button @tap="makePhoneCall">拨打电话</button>
	</view>
</template>

<script>
	import mix from '@/mixins/index.js'
	import {
		getMemberInfo
	} from '@/api/user/index.js'
	export default {
		name:"User",
		mixins:[mix],// 注册混入
		data() {
			return {
			
			};
		},
		onLoad(){
			
		},
		onShow() {
			// console.log(this);
			if(!this.checkIsLogin()) return
			
			// console.log(123);
			this.getUserInfo()
			// uni.$on 事件监听
			uni.$on('onMsg',(res)=>{
				console.log("$on res===>",res);
			})
			
			uni.$once('onEvent',(res)=>{
				console.log("onEvent=>",res);
			})
			
			
		},
		methods:{
			async getUserInfo(){
				const res = await getMemberInfo()
			},
			goCart(){
				uni.navigateTo({
					url:'./cart/cart'
				})
			},
			goOrderStatus(){
				uni.navigateTo({
					url:'/pages/user/orderStatus/orderStatus'
				})
			},
			makePhoneCall(){
				uni.makePhoneCall({
					phoneNumber:'15002661537'
				})
			}
		},
		
		// 页面卸载的时候，需要关闭监听
	
		
		
	}
</script>

<style lang="scss" scoped>

</style>
